package com.sykj.utils;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @ClassName ResponseResult
 * @Description TODO
 * Author JiangPengCheng
 * Date 2020/7/15 9:13
 **/
@Data
public class ResponseResult implements Serializable {
    private Integer code;
    private String  message;
    private Object object;

    public ResponseResult() {
    }

    public ResponseResult(Integer code, String message, Object object) {
        this.code = code;
        this.message = message;
        this.object = object;
    }

    public  ResponseResult(ResultCode resultCode,Object o) {
        this.code = resultCode.getCode();
        this.message = resultCode.getMsg();
        this.object=o;
    }
    public  ResponseResult(ResultCode resultCode) {
        this.code = resultCode.getCode();
        this.message = resultCode.getMsg();

    }

    public static ResponseResult ok(String message){
        return new ResponseResult(200,message,null);
    }

    public static ResponseResult ok(String message,Object object){
        return new ResponseResult(200,message,object);
    }

    public static ResponseResult error(String message){
        return new ResponseResult(500,message,null);
    }
    public static ResponseResult error(String message,Object o){
        return new ResponseResult(500,message,o);
    }
}
